package day_2022_4_to_7.day48;

import java.util.Scanner;

/**
 * 有假币
 * @author haomin
 * @date 2022/05/27 18:40
 **/
public class Day29_2_CounterfeitMoney {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num;
        while ((num = in.nextInt()) > 0) {
            System.out.println(getCount(num));
        }
    }

    private static int getCount(int num) {
        if(num == 3 || num == 2){
            return 1;
        }
        if(num == 1){
            return 0;
        }
        int metage,rest,times=0;
        // 3等分前，先加2，使得metage的值尽量大于rest
        // (metage,metage,rest)
        metage = (num+2)/3;
        rest = num-2*metage;

        times= 1 + getCount(Math.max(metage, rest));
        return times;
    }
}